from functools import reduce

lst = [1,23,4,5,6,7,9]
# print(list(filter(lambda i: i % 2 == 0, lst)))
str1 = "hellow world flask jonh jack heoow hellow world world"
lst2 = str1.split(" ")
res = list(map(lambda item: { item :1}, lst2))
print(res)



def fn(dict1,dict2):
    print(dict1)
    print(dict2.items())
    key = list(dict2.items())[0][0]
    value = list(dict2.items())[0][1]
    print(dict1.get(key,0))
    dict1[key] = dict1.get(key,0) + value
    return dict1

res2 = reduce(fn, res)
# print(res2)

print(sorted(lst, reverse=True))
print(sorted(res2, key=lambda item: item[1]))
